package com.shire.web.console.common;

/**
 * 作者:  sll
 * 结果类
 */
public class Response {
	/**
	 * 代码   200成功  500失败   
	 */
	private int code; 
	/**
	 * 信息
	 */
	private String message; //1.success  2.fail  3.其他提示信息
	/**
	 * data
	 */
	private Object data; //数据


	public Response() {
		this.code = 200;
		this.message = null;
		this.data = null;
	}
	public Response(int code) {
 		this.code = code;
		this.message = null;
		this.data = null;
	}
	public Response(int code, String message) {
 		this.code = code;
		this.message = message;
	}
	public Response(int code, String message, Object data) {
		this.code = code;
		this.message = message;
		this.data = data;
	}
	public Response(Object data) {
		this.code = 200;
		this.message = null;
		this.data = data;
	}
	
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	public void error(String message) {
		this.message = message;
		this.code = 500;
 	}
	public void error(String message,Object data) {
		this.message = message;
		this.code = 500;
		this.data =data;
 	}
	public void success(String message) {
		this.message = message;
		this.code = 200;
	}
	public void success(String message,Object data) {
		this.message = message;
		this.code = 200;
		this.data =data;
	}
}
